package section1_4;

import java.util.concurrent.TimeUnit;

/**
 * Created by Hyman on 2017/4/24.
 *
 * 线程的中断
 */
public class Main {

    public static void main(String[] args) {

        Thread task = new PrimeGenerator();
        task.start();

        // 主线程休眠5s
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // 质数生成线程中断
        task.interrupt();
    }
}
